<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="/wondershare/js/jquery.js"></script> 
<link href="/wondershare/styles/main.css" rel="stylesheet" type="text/css" />
<link href="/wondershare/styles/general.css" rel="stylesheet" type="text/css" />
<title>NewsRoom管理</title>
<script>
function  delete_new(id,type,act_type)
{
  var str = "";
  var falge = false;
  if(type == 'list')//代表为多选
  {
	  if(!confirm('您确定要删除选中的new记录吗？'))
	  {
		  $('input[name="ID[]"]').each(function () {
			  $(this).attr('checked',false)
		  })
		  return false;
	  }
      $('input[name="ID[]"]').each(function () {
      if ($(this).attr('checked')) 
	  {
		falge = true;
       str += $(this).val() + ",";
	   $("#tr_"+$(this).val()).remove();
	   $('#total').html(parseInt($('#total').html())-1) ;
       }
      });
	  if(!falge)
	  {
	   alert('你没有选择任何选项！');   
	  }

  }else
  {
	str = id+','; 
	$("#tr_"+id).remove();
	$('#total').html(parseInt($('#total').html())-1) ;
  }
 if(act_type == 'new')//代表为广告删除
  {

	 $.get("/wondershare/news_room.php?action=del", {checkList: str },
     function(data){
		
    }); 
  }
   
}

function  check_info(id,check_span_id,td_check_id,length,type)
{
 value = ($('#'+check_span_id).html());
 value = value.replace(/"/g,'&quot;');
 $("#"+check_span_id).remove();
 $("#"+td_check_id).html('<input type="text" id="'+check_span_id+'"  value="'+value+'"   style="width:'+length+'px" />');
 $("#"+check_span_id).focus();
 $("#"+check_span_id).blur( function () { 							  
 var check_value = $('#'+check_span_id).val();		
 if(type == 'new_sort' )
 {
	 check_value = parseInt(check_value);
 }	
 var str ="<span   id='"+check_span_id+"' >"+check_value+"</span>";
 $("#"+td_check_id).html("");
 $("#"+td_check_id).html(str);
 $("#"+check_span_id).mouseout( function () { check_css(check_span_id,0); }); 
 $("#"+check_span_id).mouseover( function () { check_css(check_span_id,1); }); 

 $("#"+check_span_id).click( function () { check_info(id,check_span_id,td_check_id,length,type); }); 
 
  if(type == 'new_sort')
  {
	  $.get("/wondershare/news_room.php?action=process_ajax", { type:type, new_id: id,value:check_value },
     function(data){
	
		 });  
  }
						
 });
}

function  check_css(element_id,type)
{
   if(type==1)
   {
	$("#"+element_id).css({  "background": "blue","color": "#ff0011"}); 
   }
   else
   {
	$("#"+element_id).css({ "background": "","color":""}); 
   }

}
</script>
</head>
<body >
<h1>

<span class="action-span">
<a href="/wondershare/news_room.php?action=edit&act=add">增加NewsRoom</a>
</span>
<div style="clear:both"></div>
</h1>
<form id="myform" name="myform" method="POST" action="/wondershare/news_room.php?action=index">
    <img height="22" border="0" width="26" alt="SEARCH" src="images/icon_search.gif">
   	标题：<input type="text"  style="width:200px;" name="new_title" value="<{$new_title|escape}>">
	创建日期：<select name="created_date" id="created_date">
	<option value="0" <{if $created_date == '0'}> selected="selected" <{/if}> >全部</option>
	<option value="2011" <{if $created_date == '2011'}> selected="selected" <{/if}>  >2011年</option>
	<option value="2010" <{if $created_date == '2010'}> selected="selected" <{/if}>  >2010年</option>
	<option value="2009" <{if $created_date == '2009'}> selected="selected" <{/if}>  >2009年</option>
	<option value="2008" <{if $created_date == '2008'}> selected="selected" <{/if}>  >2008年</option>
	<option value="2007" <{if $created_date == '2007'}> selected="selected" <{/if}>  >2007年</option>
	</select>  
    文章ID：<input type="text" size="5" name="new_id" value="<{$new_id}>">
    <input type="submit" class="button" name="search" value=" 搜索 ">
</form>
<table width="100%" cellspacing="1" cellpadding="2" id="list-table" class="list-div">
<tbody>
  <tr>
    <th align="center">ID</th>
	<th align="center">New标题</th>
	<th align="center">keyword</th>
	<th align="center">summary</th>
	<th align="center">创建人</th>
	<th align="center">创建时间</th>
	<th align="center">访问次数</th>
	<th align="center">排序</th>
    <th align="center">修改人</th>
    <th align="center">修改时间</th>
	<th align="center">编辑</th>
  </tr>
<{foreach from=$new_info item=rows}>
  <tr align="center"  id="tr_<{$rows.id}>">
	<td width="5%" align="center">
   <input value="<{$rows.id}>" name="ID[]" type="checkbox" > <{$rows.id}>
	</td>
	<td width="15%" align="center">
    <{$rows.title|escape}>
	</td>
	<td width="10%" align="center">

	<{$rows.keyword|truncate:80:"...":true}>
	</td>
	<td width="12%" align="center">
	<{$rows.summary|truncate:80:"...":true}>
	</td>
	<td width="8%" align="center">
	<{$rows.author|escape}>
	</td>
	<td width="10%" align="center">
	<{$rows.created|escape}>
	</td>
 	<td width="5%" align="center">
    <{$rows.hits}>
	</td>
	<td width="10%" align="center" id="td_order_<{$rows.id}>">
	<span onmouseout="check_css('sort_order_<{$rows.id}>',0);" onmouseover="check_css('sort_order_<{$rows.id}>',1);"      
	onclick="check_info('<{$rows.id}>','sort_order_<{$rows.id}>','td_order_<{$rows.id}>',60,'new_sort');"  id="sort_order_<{$rows.id}>" ><{$rows.order_id}></span>
	</td>   
	<td width="8%" align="center">
    <{$rows.update_time}>
	</td> 
	<td width="7%" align="center">
	 <{$rows.update_user}>
	</td>
	<td width="10%" align="center">

	<a href="/wondershare/news_room.php?action=edit&act=update&new_id=<{$rows.id}>" > 修改</a>&nbsp;&nbsp;
	<a href="#" onclick="{if(confirm('确定要删除记录吗?')){delete_new(<{$rows.id}>,'list_new_id','new');}return false;}" >删除</a> &nbsp;&nbsp;
    </td>
  </tr>
 <{/foreach}>
  <tr >
	    <td colspan="11"  ><div style="margin-left:10px;">
		 <input name="checkall" value="checked" onclick="v=document.getElementsByName('ID[]');if(this.checked){for(i=0;i<v.length;i++)v[i].checked=true;}else{for(i=0;i<v.length;i++)v[i].checked=false;}" type="checkbox">全选&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="sub" value="删除" type="button" onclick="delete_new(0,'list','new');">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		 <{$page_url}> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 共有 <span id="total"><{$total}> </span>条记录</div></td>
	</tr>
  </tbody>
</table>
</body>
</html>